//
//  baseTableViewController.swift
//  微博
//
//  Created by mac on 15/12/14.
//  Copyright © 2015年 itcats. All rights reserved.
//

import UIKit

class baseTableViewController: UITableViewController,VisitorLoginViewDelegate {
  var userLogin = UserAccountViewModel().userLogin
    var visitorLoginView: VisitorLoginView?
    override func loadView() {
        if userLogin{
        super.loadView()
        }else{
            setVisitorLoginView()
        }
    }
    private func setVisitorLoginView(){
    visitorLoginView = VisitorLoginView()
   //设置代理
        visitorLoginView?.visitroViewDelegate = self
        view = visitorLoginView
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: .Plain, target: self, action: "userWillLogin")
         self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    func userWillLogin() {
        print(__FUNCTION__)
        let oauth = OAuthViewController()
        //添加到导航视图控制器
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
    }
    func userWillRegister() {
        print(__FUNCTION__)
    }
    
    
    
}

